Skip to content

ZCU-PUB/Make Solr heap tunable via SOLR_HEAP (backport #1309)#1325

Merged
milanmajchrak merged 1 commit into
customer/zcu-pubfrom
zcu-pub/be-tunable-solr-heap
Jun 25, 2026
Merged

ZCU-PUB/Make Solr heap tunable via SOLR_HEAP (backport #1309)#1325
milanmajchrak merged 1 commit into
customer/zcu-pubfrom
zcu-pub/be-tunable-solr-heap

Conversation

@jr-rk

@jr-rk jr-rk commented Jun 25, 2026

Copy link
Copy Markdown

Problem

The Solr heap in docker/docker-compose-rest.yml is hardcoded to -m 4g. Combined with
-XX:+AlwaysPreTouch, the container commits the full 4 GB on start, which is wasteful on
shared dev hosts running several DSpace stacks. Operators cannot lower the heap without
editing a tracked file.

Backport of #1309 to customer/zcu-pub.
Tracking issue: dataquest-dev/dspace-customers#746

Root cause

The Solr launch command was written with a literal heap argument (-m 4g) instead of an
environment-driven one, so there is no runtime knob and AlwaysPreTouch forces the full
allocation up front.

Change set

Single-line change to the dspacesolr entrypoint in docker/docker-compose-rest.yml:

-      exec solr -p 898${INSTANCE} -f -m 4g
+      exec solr -p 898${INSTANCE} -f -m "${SOLR_HEAP:-4g}"

Translated, not cherry-picked (per the FE backport model). On this branch (7.6.1 family)
the Solr launch uses -p 898${INSTANCE}, not the source PR's -p 8983, so only the -m 4g
argument was changed; the port and every other line are untouched. The value is quoted
("${SOLR_HEAP:-4g}") to survive word-splitting, matching the source PR's follow-up fix.

Intentionally out of scope: the default heap value (stays 4g), other services, ports,
Solr image/version, and AlwaysPreTouch.

Test evidence

Static fingerprints:

$ grep -n 'm "${SOLR_HEAP:-4g}"' docker/docker-compose-rest.yml
164:      exec solr -p 898${INSTANCE} -f -m "${SOLR_HEAP:-4g}"

$ grep -n 'm 4g' docker/docker-compose-rest.yml
(no matches — hardcoded value gone)

$ git diff --stat
 docker/docker-compose-rest.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Compose render (Docker Compose interpolates ${SOLR_HEAP:-4g}, demonstrating both paths;
INSTANCE=0 set only to silence unset-var noise):

# Default path — SOLR_HEAP unset:
$ docker compose -f docker/docker-compose-rest.yml config | grep 'exec solr'
      exec solr -p 8980 -f -m "4g"

# Override path — SOLR_HEAP=1g:
$ SOLR_HEAP=1g docker compose -f docker/docker-compose-rest.yml config | grep 'exec solr'
      exec solr -p 8980 -f -m "1g"

# Valid render:
$ docker compose -f docker/docker-compose-rest.yml config --quiet ; echo $?
0

Default preserved (4g), override honored (1g), YAML/interpolation valid.

Risk & rollback

  • Risk: Very low — single-line, default-preserving config change. Main failure mode would
    be an unquoted/typo'd interpolation; mitigated by the quoting and the compose-render check above.
  • Backward compatible: Full. Unset SOLR_HEAP reproduces the prior 4 GB behavior exactly;
    existing .env/compose overrides that don't set SOLR_HEAP keep working.
  • Rollback: Revert this one-line change (or the PR). No state, migration, or data implications.

Notes / assumptions

  • Source PR: Make Solr heap tunable via SOLR_HEAP (default 4g, no behavior change) #1309 (commits 27253a3 env var, 0d652dc quoting).
  • Sibling target customer/mendelu from the tracking issue is not included: that branch
    (DSpace 9.1) launches Solr via solr-foreground and has no hardcoded -m 4g line to
    translate, so the backport does not apply there. Reported separately on the tracking issue.

🤖 Generated with Claude Code

Backport of #1309 to customer/zcu-pub.
Translate (not cherry-pick) the single Solr heap line against this
branch's actual compose file: the launch uses -p 898${INSTANCE}, so only
the -m 4g argument is changed to -m ${SOLR_HEAP:-4g}. With SOLR_HEAP
unset the 4g default is preserved; AlwaysPreTouch no longer forces the
full 4g commit when a smaller heap is set.

Refs dataquest-dev/dspace-customers#746

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d092d24b-b4fc-4ba5-84ff-4f049d6a57de

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jr-rk jr-rk self-assigned this Jun 25, 2026
@jr-rk jr-rk requested a review from Copilot June 25, 2026 11:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes the Solr JVM heap size configurable in the dev/test Docker Compose setup by replacing a hardcoded heap value with a ${SOLR_HEAP:-4g} defaulted variable, keeping existing behavior unchanged when the variable is not set.

Changes:

  • Replace hardcoded -m 4g with -m "${SOLR_HEAP:-4g}" in the dspacesolr entrypoint command.
  • Preserve the prior default heap size (4g) while enabling operators to override via Compose variable interpolation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jr-rk jr-rk requested a review from milanmajchrak June 25, 2026 13:47
@milanmajchrak milanmajchrak merged commit 5424662 into customer/zcu-pub Jun 25, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants